<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>特色肉食_莞工零食商城</title>
    <link rel="shortcut icon" href="/static/user/images/guangong.ico">
    <link rel="stylesheet" href="/static/user/css/reset.css">
    <link rel="stylesheet" href="/static/user/css/common.css">
    <link rel="stylesheet" href="/static/user/css/cxls.css">
    <link rel="stylesheet" href="//at.alicdn.com/t/font_2077656_tefo30nlsx.css">
    <style>
        .mid{
            width: 80%;
            margin: 0 auto;
            margin-top: 10px;
        }
        /* 目录部分 */
        .mulu{
            height: 28px;
            line-height: 28px;
            padding: 1px 0px;
        }
        .mulu a{
            color: #333333;
            font-size: 12px;
        }
        .mulu .fengefu{
            color: #bbbbbb;
        }
        .mulu a:hover{
            color: #eb0742;
        }
        /* 中间部分 */
        .mid-container{
            width: 100%;
        }
        /* 左边栏 */
        .aside-left{
            width: 215px;
            background-color: #ffffff;
        }
        .aside-left .side-left-title{
            width: 215px;
            height: 54px;
            line-height: 54px;
            font-size: 18px;
            color: #333;
            text-indent: 15px;
            font-weight: 400;
            border: 1px solid #ccc;
            box-sizing: border-box;
        }
        .aside-left .side-left-title:hover{
            background-color: #fafafa;
        }
        .second-cate{
            border: 1px solid #eee;
            padding: 10px 0;
        }
        .second-cate a{
            display: block;
            height: 35px;
            width: 100%;
            line-height: 35px;
            text-indent: 15px;
            color: #888888;
            font-size: 14px;
        }
        .second-cate a:hover{
            background-color: #f0f0f0;
            color: #09c762;
        }
        .second-cate .curr{
            background-color: #f0f0f0;
            color: #eb0742 !important;
        }
        
        /* 右边栏 */
        .aside-right{
            width: 80%;
            height: 800px;
        }
        .brands-price{
            width: 970px;
            border: 1px solid #eeeeee;
            box-sizing: border-box;
            padding: 0 25px;
            background-color: #ffffff;
            margin-bottom: 10px;
        }
        .bp-list{
            padding: 10px 0px;
        }
        .list-title{
            display: inline-block;
            color: #333333;
            font-size: 14px;
            margin: 0 10px 0 0;
        }
        .list-item{
            display: inline-block;
        }
        .list-item a{
            border-radius: 5px;
            display: inline-block;
            width: 75px;
            margin: 0 25px;
            height: 25px;
            line-height: 25px;
            font-size: 12px;
            color: #666666;
            
            text-align: center;
        }
        .list-item a:hover{
            color: #09c762;
        }
        .list-item .curr{
            background-color: #FF5555;
            color: #ffffff;
        }
        .list-item .curr1{
            background-color: #FF5555;
            color: #ffffff;
        }
        /* 特色肉食商品列表 */
        .items{
            width: 970px;
        }
        .items-info{
            background-color: #ffffff;
            width: 232px;
            height: 342px;
            border: 1px solid #eee;
            font-size: 12px;
            display: inline-block;
            margin-right: 4px;
            margin-bottom: 10px;
        }
        .items-info:hover{
            border-color: #eb0742;
        }
        .items-img{
            height: 230px;
            width: 230px;
            margin-bottom: 10px;
        }
        .items-price{
            width: 230px;
            height: 20px;
            line-height: 20px;
            text-align: center;
            color: #eb0742;
            font-size: 14px;
            font-weight: bold;
        }
        .items-description{
            height: 35px;
            width: 230px;
            padding: 0 10px;
            box-sizing: border-box;
            margin: 10px 0;
        }
        .items-salenum{
            color: #999999;
            padding: 0px 10px;
        }
        .items-salenum .salenum{
            color: #eb0742;
        }
    </style>
</head>
<body>
<!-- 头部logo、搜索框、导航栏 -->
{include file="common/header"}
<!--  -->
<div class="mid">
    <div class="mulu">
        <a href="">首页</a>
        <span class="fengefu">></span>
        <a href="getcategoods?id={$id}">特色肉食</a>
    </div>
    <div class="mid-container clearfix">
        <div class="aside-left left clearfix">
            <h1 class="side-left-title"><a href="getcategoods?id={$id}" style="display: block;">{$OneCateName}</a></h1>
            <ul class="second-cate">
                <!-- <a class="curr" href="getcategoods?id={$id}">全部</a> -->
                <!-- {volist name="$goodscate" id="c"}
                <a href="getcategoods?id={$c.id}">{$c.cate_name}</a>
                {/volist} -->
            </ul>
        </div>
        <div class="aside-right right clearfix">
            <div class="brands-price">
                <dl class="bp-list">
                    <dt class="list-title">价格：</dt>
                    <dd class="list-item">
                        <a {if $qujian=='0-70'}class="curr"{/if} href="getcategoods?id={$id}&qujian=0-70">0-70</a>
                        <a {if $qujian=='70-130'}class="curr"{/if} href="getcategoods?id={$id}&qujian=70-130">70-130</a>
                        <a {if $qujian=='130-250'}class="curr"{/if} href="getcategoods?id={$id}&qujian=130-250">130-250</a>
                        <a {if $qujian=='250-1000000'}class="curr"{/if} href="getcategoods?id={$id}&qujian=250-1000000" href="getcategoods?id={$id}">其他</a>
                    </dd>
                </dl>
            </div>
            <ul class="items">
                {volist name="$goods" id="g"}
                <li class="items-info">
                    <a href="/user/index/getgoodsdetail?id={$g.id}">
                        <div class="items-img">
                            <img src="/static/admin/uploads/{$g.thumb}" alt="">
                        </div>
                        <div class="items-price">￥{$g.sale_price}元</div>
                        <div class="items-description">
                            {$g.goods_name}
                        </div>
                        <div class="items-salenum">
                            销量：<span class="salenum">{$g.sale_num}</span> 件
                        </div>
                    </a>
                </li>
              {/volist}
            </ul>
        </div>
    </div>
</div>
<!-- 楚雄零食商城页尾 -->
<div class="footer">
    <div class="footer-top">
        <div class="footer-top-container">
            <a href="#">
                <img src="/static/user/images/f1.png" alt="">
            </a>
            <a href="#">
                <img src="/static/user/images/f2.png" alt="">
            </a>
            <a href="#">
                <img src="/static/user/images/f3.png" alt="">
            </a>
            <a href="#">
                <img src="/static/user/images/f4.png" alt="">
            </a>
        </div>
    </div>
    <div class="footer-bottom">
        <div class="footer-bottom-container">
            <ul class="links">
                <a href=""><li class="link-item">免责条款</li></a>
                <a href=""><li class="link-item">隐私保护</li></a>
                <a href=""><li class="link-item">咨询热点</li></a>
                <a href=""><li class="link-item">联系我们</li></a>
                <a href=""><li class="link-item">公司简介</li></a>
                <a href=""><li class="link-item">批发方案</li></a>
                <a href=""><li class="link-item">配送方式</li></a>
            </ul>
            <p class="copyright">
                2019-2025 © 零食商城 所有 地址：中国·广东·东莞 服务时间：09:00-22:00
            </p>
            <div class="hexin-logo">
                <img src="/static/user/images/hexin.png" alt="">
            </div>
            <div class="cnzz">
                <img src="/static/user/images/pic2.gif" alt="">
            </div>
        </div>
    </div>
</div>
<!-- 右下角固定列表 -->
<div id="fixed-list">
    <a class="ret" onclick="backtoTop();">
        <img src="/static/user/images/gotop.png" alt="">
    </a>
</div>
</body>
<script src="/static/user/js/jquery-3.4.1.js"></script>
<script>
    $(function(){
        $('.second-cate').html(` {volist name="$goodscate" id="c"}
                <li><input type="hidden" value="{$c.id}" id="cid"><a href="javascript:;" onclick="changeCurr(this,{$c.id});">{$c.cate_name}</a></li>
                {/volist}`);
    })
    // 修改选择的二级分类的样式curr
    function changeCurr(_this,id){
        $(_this).parent().siblings('li').find('a').removeClass("curr");
        $(_this).addClass("curr");
        // 修改右边显示内容
        $.ajax({
            url:"/user/index/ajaxgetcategoods",
            type:"get",
            data:{
                id:id,
                qujian:$('.list-item a').hasClass('.curr')?$('.list-item .curr').text():''
            },
            dataType:'JSON',
            success:function(res){
                $('.items').html('');
                for (let index = 0; index < res['data'].length; index++) {
                     console.log(res['data'][index]);
                    $('.items').append(`<li class="items-info">
                    <a href="/user/index/getgoodsdetail?id=`+res['data'][index].id+`">
                        <div class="items-img">
                            <img src="/static/admin/uploads/`+res['data'][index].thumb+`" alt="">
                        </div>
                        <div class="items-price">￥`+res['data'][index].sale_price+`元</div>
                        <div class="items-description">
                            `+res['data'][index].goods_name+`
                        </div>
                        <div class="items-salenum">
                            销量：<span class="salenum">`+res['data'][index].sale_num+`</span> 件
                        </div>
                    </a>
                </li>`);
                $('.bp-list').html(`<dt class="list-title">价格：</dt>
                    <dd class="list-item">
                        <a  href="javascript:;" onclick='addcurr(this)'>0-70</a>
                        <a href="javascript:;" onclick='addcurr(this)'>70-130</a>
                        <a href="javascript:;" onclick='addcurr(this)'>130-250</a>
                        <a href="javascript:;" onclick='addcurr(this)'>其他</a>
                    </dd>`)
                }
                
                
            }
        })
        
    }

    function addcurr(_this){
        $(_this).siblings().removeClass('curr');
        $(_this).addClass('curr');
        $.ajax({
            url:"/user/index/ajaxgetcategoods",
            type:"get",
            data:{
                id:$('.second-cate .curr').siblings('input').val(),
                qujian:$(_this).html()
            },
            dataType:'JSON',
            success:function(res){
                $('.items').html('');
                for (let index = 0; index < res['data'].length; index++) {
                     console.log(res['data'][index]);
                    $('.items').append(`<li class="items-info">
                    <a href="/user/index/getgoodsdetail?id=`+res['data'][index].id+`">
                        <div class="items-img">
                            <img src="/static/admin/uploads/`+res['data'][index].thumb+`" alt="">
                        </div>
                        <div class="items-price">￥`+res['data'][index].sale_price+`元</div>
                        <div class="items-description">
                            `+res['data'][index].goods_name+`
                        </div>
                        <div class="items-salenum">
                            销量：<span class="salenum">`+res['data'][index].sale_num+`</span> 件
                        </div>
                    </a>
                </li>`);
               
                }
                
                
            }
        })

    }
    //右下角固定列表返回顶部
    function backtoTop(){
        $("body,html").animate({scrollTop:'0px'},2000);
    }
    // 滚动条下拉后显示固定列表
    function show(){
        $(window).scroll(function(){
            if($(window).scrollTop() > 200){
                $("#fixed-list").fadeIn(1000);
            }
            else{
                $("#fixed-list").fadeOut(1000);
            }
        })
    }
    show();
</script>
</html>